import { MockMethod } from 'vite-plugin-mock'
// @ts-ignore
import Mock from "mockjs";

const list = Array(10).fill(0).map((_, i) => ({
  id: Mock.mock('@id'),
  userid: Mock.mock('@id'),
  amount: Mock.mock('@integer(0, 1000)'),
  created_at: Mock.mock('@date(yyyy-MM-dd hh:mm:ss)'),
  updated_at: Mock.mock('@date(yyyy-MM-dd hh:mm:ss)'),
  deleted_at: Mock.mock('@date(yyyy-MM-dd hh:mm:ss)'),
  mark: Mock.text(10),
  tag: Mock.random(["😎", "😄", "🤣", "🤩", "😘", "😍", "😜", "😊", "😎", "😄", "🤣", "🤩", "😘", "😍", "😜", "😊"]),
  type: Mock.random([1, 2]) // 1-income 2-expense
}))
export default [
  {
    url: '/mock/api/payment/summary',
    method: 'post',
    response: ({ body }) => {
      return {
        code: 0,
        msg: '成功',
        data: {
          balance: Mock.integer(1000, 10000),
          expense: Mock.integer(1000, 10000),
          income: Mock.integer(1000, 10000),
        }
      }
    }
  },
  {
    url: '/mock/api/payment/list',
    method: 'post',
    response: ({ body }) => {
      return {
        code: 0,
        msg: '登录成功',
        data: {
          page: 1,
          offset: 0,
          limit: 10,
          total: 100,
          list
        }
      }
    }
  }
] as MockMethod[]
